﻿@model IEnumerable<HRWEB.Magazine>
@using HRWEB.HtmlHelpers
@using HRWEB
<script type="text/javascript">
    jQuery(document).ready(function () {
        $('#magazineList').dataTable({ 
            "bPaginate": true,
            "bFilter": false,
            "bSort": true,
            "bInfo": false,
            "bAutoWidth": false,
            "bStateSave": true,
            "fnDrawCallback": function (oSettings) {
                $(".detail-table-small tr").each(function (i) {
                    $(this).hover(function () {
                        $(this).addClass('color3');
                    }, function () {
                        $(this).removeClass('color3');
                    });
                    if ($(this).hasClass('color1')) {
                        $(this).removeClass('color1');
                    }
                    if ($(this).hasClass('color2')) {
                        $(this).removeClass('color2');
                    }
                    if (i % 2) { $(this).addClass('color1'); }
                    else { $(this).addClass('color2'); }
                });
            }
        });
    });
</script>           
@{
    ViewBag.Title = "影响因子维护";
}
@using (Html.BeginForm("ListMagazines", "Magazine"))
{
    <table>
    <tr><td>输入名称来进行模糊查询</td><td>@Html.TextBox("name")</td><td><input type="submit" value="查询" /></td></tr>
    </table>
    <table id="magazineList" class="detail-table-small">
    <thead>@Html.GetTableRow(new string[] { "期刊名称", "期刊类别", "CN", "ISSN", "选择", "删除" })</thead>
    <tbody>
@foreach (var it in Model)
{
<tr><td>@it.Name</td><td>@Html.FormatTDict(it.DictMagazineType)</td><td>@it.CN</td><td>@it.ISSN</td><td>@Html.ActionLink("选择", "SelectMagazine", new { serialNO = it.SerialNO, name = (string)ViewBag.Name })</td><td>@Html.ActionLink("删除", "DeleteMagazine", new { serialNO = it.SerialNO, name = (string)ViewBag.Name })</td></tr>    
}
    </tbody>
    </table>
}
@{Html.RenderAction("CreateMagazine");}
@{
    IEnumerable<MagazineInflunceFactor> mif;
    string magaName;
    if (Model.Any() && ViewBag.SelectedMagazineNO != null)
    {
        magaName = Model.Where(p => p.SerialNO == int.Parse(ViewBag.SelectedMagazineNO)).Single().Name;
        mif = Model.Where(p => p.SerialNO == int.Parse(ViewBag.SelectedMagazineNO)).Single().MagazineInflunceFactors.OrderByDescending(p=>p.Year);
<div style="font-weight:bold;font-size:large">当前选择期刊名称： @magaName</div>
<table class="detail-table-small">
<thead>@Html.GetTableRow(new string[] { "期刊名称","年份", "级别", "影响因子" })</thead>
<tbody>@if (!mif.Any())
       {
    <tr align="left"><td colspan="2">没有数据可以显示</td></tr>
       }
@foreach (var it in mif)
{
<tr><td>@magaName</td><td>@it.Year</td><td>@Html.FormatTDict(it.DictMagazineGrade)</td><td>@it.Factor</td></tr>    
}</tbody>
</table>
    }
}
@if(Session["SelectedMagazineNO"]!=null){
Html.RenderAction("CreateMagazineInflunceFactor");}